package com.hshx.message.Impl;

import com.hshx.message.IMessageService;
import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.stereotype.Component;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

@Component
@Service
public class IMessageServiceImpl implements IMessageService {

    @Resource
    private RabbitTemplate template;


    private void sendMessage(String exchange,String routingKey,Object message){
        this.template.convertAndSend(exchange,routingKey,message);
    }

    @Override
    public void send(String msg) {
        this.sendMessage("zhaoPing","zp",msg);
    }
}
